package com.mdd.common.enums;

import com.google.common.collect.Maps;

import java.util.Map;

public enum OrderRefundStatusEnum {
    // 退款申请状态:0-退款中;1-退款成功;2-退款失败;
    REFUNDING(0, "退款中"),
    SUCCESS(1, "退款成功"),
    FAILURE(2, "退款失败"),
    CLOSE(3, "退款关闭");

    private final int status;
    private final String desc;

    OrderRefundStatusEnum(int status, String desc) {
        this.status = status;
        this.desc = desc;
    }

    /**
     * 获取状态码
     *
     * @return Long
     * @author fzr
     */
    public int getStatus() {
        return this.status;
    }

    /**
     * 获取提示
     *
     * @return String
     * @author fzr
     */
    public String getDesc() {
        return this.desc;
    }

    public static Map<Integer, String> getMap() {
        Map<Integer, String> map = Maps.newHashMap();
        for (OrderRefundStatusEnum codeEnum : OrderRefundStatusEnum.values()) {
            map.put(codeEnum.status, codeEnum.desc);
        }
        return map;
    }

    public static String getEnum(int status) {
        for (OrderRefundStatusEnum codeEnum : OrderRefundStatusEnum.values()) {
            if (codeEnum.status == status) {
                return codeEnum.desc;
            }
        }
        return null;
    }
}
